<?php
namespace Admin\Controller;
use Think\Controller;
class UserController extends Controller {
    public function index(){
    	//统计user表的总数;
    	$count = M('user')->count();
    	//new一个类 传进总数和显示多少条数据出来;
    	$page = new \Think\Page($count,3);
    	//通过show方法输出分页的数量;
        $show = $page->show();
        //分配到模板
        $this->assign('show',$show);
        //分页类的方法计算出要在user表中取出第几条数据和取出多少条数据;
        $sql = "select * from user limit ".$page->firstRow.",".$page->listRows;
    	$res = M()->query($sql);
    	$this->assign('res',$res);
        $this->display();
    }
   
}